package Zadanie7;
import java.io.Serializable;
import java.util.Random;


public class Matrix implements Serializable {
	
	double[][] matrix;
	int n;
	int m;
	
	Matrix(int n, int m) {
		
		this.n = n;
		this.m = m;
		matrix = new double[n][m];
		
	
		
		System.out.println("Generowanie macierzy... " );
		
		for(int i=0; i<n; i++) {
			
			for(int j=0; j<m; j++) {
				
				matrix[i][j] = Math.random();

			}
		
		}
		//printMatrix();						
	}
	
	Matrix(int n, int m, Boolean zero) {
		
		this.n = n;
		this.m = m;
		matrix = new double[n][m];
		
		
		
		for(int i=0; i<n; i++) {
			
			for(int j=0; j<m; j++) {
				
				matrix[i][j] = 0;
			
			}
			
			
		}
		
		
	}
	
	
	public double[][] getTab() {
		
		return matrix;
		
	}
	
	public int getRow() {
		return n;
	}
	
	public int getCol() {
		return m;
	}
	public void printMatrix(){
		for (int i = 0; i < n; i++) {
		    for (int j = 0; j < n; j++) {
		        System.out.print(matrix[i][j] + " ");
		    }
		    System.out.print("\n");
		}
	}

	@Override
	public String toString() {
		String string = ""; 
		for (int i = 0; i < n; i++) {
		    for (int j = 0; j < n; j++) {
		        string +=   matrix[i][j] + " ";
		    }
		    string +="\n";
		}
		return string;
	}
	

}
